﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sausage.Data;

namespace Sausage.Domain
{
    public class UserHelper
    {
        public static User GetUserByName(string userName)
        {
            using(var context = new SausageEntities())
            {
                return context.User.FirstOrDefault(user => user.UserName.ToLower() == userName.ToLower());
            }
        }

        public static User GetUserByID(Guid userID)
        {
            using (var context = new SausageEntities())
            {
                return context.User.FirstOrDefault(user => user.UserID == userID);
            }
        }

        public static List<User> GetUserList()
        {
            using (var context = new SausageEntities())
            {
                return context.User.ToList();
            }
        }
    }
}
